#ifndef __GLF_TASK_TASKGROUPS_H_INCLUDED__
#define __GLF_TASK_TASKGROUPS_H_INCLUDED__

namespace glf {

namespace task_detail
{
	class Group;
	Group* GrabGroup();
	void DropGroup(Group*);
	Group* GetGroup();
	Group* SetGroup(Group*);
}


class TaskGroupScope
{
public:
	TaskGroupScope();
	~TaskGroupScope();

	void Push();
	void Pop();
	bool HasPendingTask();

	template <typename Tag1>
	void Wait();

	template <typename Tag1, typename Tag2>
	void Wait();

protected:
	task_detail::Group* GetGroup();
	bool HasPendingTask(task_detail::Group*);

	task_detail::Group* m_Group;
	GLF_ASSERT_ONLY(int m_PushPopCounter;)
};


} // end namespace glf

#include <glf/task/taskGroups_impl.h>

#endif // __GLF_TASK_TASKGROUPS_H_INCLUDED__
